import { PopCommon2Base } from "./PopCommon2.generated";

const { regClass } = Laya; 

@regClass()
export class PopCommon2 extends PopCommon2Base {
    public showPop(msg: string,color:string) {
        this.imgBG.visible = false;
        this.txtMsg.visible = false;
        this.imgIcon.visible = false;
        this.txtMsg.text = msg;
        this.txtMsg.color = color; 
        
        Laya.timer.frameOnce(1, this, this.show)
    }
    public hidePop() {
        this.timer.clear(this, this.show)
        this.timer.clear(this, this.hidePop)
        this.destroy();
    }

    private show() {
        this.imgBG.visible = true;
        this.txtMsg.visible = true;
        this.imgIcon.visible = true; 
        this.width = this.txtMsg.width + 40 + 20 + 20 + 10;

        this.timerOnce(1500, this, this.hidePop)
    }
}